      <div class="templatemo-content-wrapper">
        <div class="templatemo-content">
          <ol class="breadcrumb">
            <li><a href="<?=site_url()?>/order/index">订单管理</a></li>
            <li class="active">录入进货价</li>
          </ol>
          <div class="row">
            <div class="col-md-12">
              <div class="table-responsive">
                <h4 class="margin-bottom-15">进货商品列表</h4>
                <table class="table table-striped table-hover table-bordered">
                  <thead>
                    <tr>
                      <th>ID</th>
                      <th>商品名称</th>
                      <th>进货价</th>
                      <th>录入时间</th>
                    </tr>
                  </thead>
                  <tbody>
                  	<?php foreach ($purprices as $item):?>
                    <tr>
                      <td><?php echo $item['id'];?></td>
                      <td><?php echo $item['name'];?></td>
                      <td><input style="width:40px" type="text" class="purprice" id="<?php echo $item['id'];?>" data-id="<?php echo $item['productid'];?>" value="<?php echo $item['purprice'];?>" onClick="select();" ><?php echo '元/'.$item['unit'];?>
                     </td>
                     <td><?php echo date("Y-m-d",strtotime($item['add_time']));?></td>
                    </tr>
                     <?php endforeach;?>
                  </tbody>
                </table>
              </div>
              <div class="col-md-12">
             	 <button class="btn btn-primary" id="submit_btn">提交</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    <script>
	$(document).ready(function() {
		$("#submit_btn").click(function() {
			 $(".purprice").each(function(){
      			var id = $(this).attr("id");
      			var productid = $(this).attr("data-id");
      			var purprice = $("#"+id).val();
      			$.ajax({
					url : '<?php echo site_url('product/setproductpurprice')?>',
					type : "post",
					async : false,
					data : {
						'id' : id,
						'productid':productid,
						'purprice':purprice
					},
					dataType : "json",
					success : function(data) {
						if(data.code)
						{
							//alert(data.msg);
						}else{
							//alert(data.msg);
						}
					}
				});
   			 });
   			 alert("更新成功");//暂时这样
		});
	}); 
</script>